package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
//游记主题
public class DestinationTheme extends BaseDomain {

    public static final int ALL_YEAR_SUIT = 0;//全年适宜
    public static final int SEASON = 1;//季节
    public static final int TRIP_MODE = 2;//出行方式
    public static final int HOLIDAY = 3;//节假日

    //主题名
    private String name;
    //主题类型
    private Integer type;
    //主题图片
    private String coverUrl;
    //序号
    private Integer sequence;
    private Destination dest;

    private List<DestinationThemeTag> tags = new ArrayList<>();

    public String getJsonString() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("type", type);
        map.put("coverUrl", coverUrl);
        map.put("sequence", sequence);
        if (dest != null) {
            map.put("destName", dest.getName());
            map.put("destId", dest.getId());
        }
        return JSON.toJSONString(map);
    }

    public String getTypeName() {
        if (type == 0) {
            return "全年适宜";
        } else if (type == 1) {
            return "季节";
        } else if (type == 2) {
            return "出行方式";
        } else {
            return "节假日";
        }
    }
}